package com.demoo.zjsu.util.HttpClientUtil;

import com.demoo.zjsu.string.BaseStrings;
import com.demoo.zjsu.string.smartwebsite.WebsiteStrings;
import com.demoo.zjsu.util.HttpClientUtil.pool.AgainConfig;
import org.apache.http.HttpRequest;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.annotation.Resources;
import java.io.IOException;

/**
 * Created by jshjsh on 2016/8/15.
 */
@Service
public class RequestConfigResolver {

 /*   @Autowired
    CloseableHttpClient client;

    public void destory() {
        if (client != null) {
            try {
                client.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    *//**
     * 单一的请求。
     * @param sender
     * @param url
     * @return
     *//*
    public String resolver(ClientSender sender,String url) {
        HttpRequestBase request = sender.getRequest(url);
        CloseableHttpResponse response = null;
        try {
            response = client.execute(request);
            return sender.getEntity(response);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            HttpClientUtils.closeQuietly(response);
            HttpClientUtils.closeQuietly(client);
        }
        return null;
    }*/

}
